#ifndef FOLDERDATASOURCE_H
#define FOLDERDATASOURCE_H

#include <filesystem>
#include <memory>
#include <set>
#include <string>
#include <vector>

class DataSource;
class FolderDataSource {
public:
    FolderDataSource(const std::filesystem::path& folderPath);
    ~FolderDataSource() = default;

    std::shared_ptr<DataSource> createDataSource();

    std::string getDisplayName();
    std::set<std::string> getListfile();

    bool has(const std::string& filepath) const;
    std::filesystem::path getDirectory(const std::string& filepath) const;

    std::vector<uint8_t> read(const std::string& path) const;
    std::shared_ptr<DataSource> getResourceAsStream(const std::string& filepath) const;
    void* getFile(const std::string& filepath) const;

private:
    static std::string fixFilepath(const std::string& filepath);

    std::filesystem::path folderPath_;
    std::set<std::string> listfile_;
};

#endif // FOLDERDATASOURCE_H
